/*
 * @Author: mikey.zhaopeng
 * @Date:   2016-02-20 17:43:30
 * @Last Modified by:   mikey.zhaopeng
 * @Last Modified time: 2016-03-10 15:42:13
 */

'use strict';
define([
    './baseBean',
], function(
    BaseBean
) {
    function me() {
        BaseBean.apply(this, arguments);
        var self = this;
        this.searchOrganization = function(callback, errorCallback) {
            if (window.localStorage.organizationInfo) {
                callback(JSON.parse(window.localStorage.organizationInfo));
                return;
            }

            self.p('/organization/searchOrganization', {}, function(result) {
                window.localStorage.organizationInfo = JSON.stringify(result);
                if (callback) {
                    callback(result);
                }
            }, errorCallback);
        }


    /**
         * { 清空缓存 }
         *
         * @method     reset
         */
        this.reset = function() {
            localStorage.removeItem('organizationInfo')
        }

    };
    return new me();
});

